<cfoutput>
	<cfif IsUserLoggedIn() and IsDefined("request.scholar") and request.scholar.Scholarship_ID gt 0>
		<cfscript>
			scholarshipGateway = new assets.calgrants.com.gateway.ScholarshipGateway();
			scholarship = scholarshipGateway.get(Scholarship_ID = GetAuthUser());
		</cfscript>
		<script type="text/javascript" language="javascript">
		<!--
			<cfoutput>
				var accountType = "#scholarship.getAccount_Type()#";
				var routingNumber = "#scholarship.getRouting_Number()#";
				var accountNumber = "#scholarship.getAccount_Number()#";
				var paymentMethod = "#scholarship.getPayment_Method()#";
			</cfoutput>
			
			var validate = function() {
				var errors = "";
				var valid = true;
				if ($("##eftPaymentMethod").is(":checked")) {
					if ($("##accountType").val().length == 0) {
						valid = false;
						errors += "Account Type is required\n";
					}
					if ($("##routingNumber").val().length == 0) {
						valid = false;
						errors += "Bank Routing Number is required\n";
					}
					if ($("##accountNumber").val().length == 0) {
						valid = false;
						errors += "Bank Account Number is required\n";
					}
				} else if ($("##checkPaymentMethod").is(":checked")) {
					$("##accountType").val("");
					$("##routingNumber").val("");
					$("##accountNumber").val("");
				}
				if (!valid) {
					alert(errors);
				}
				return valid;				
			}
			
			var togglePaymentMethod = function() {
				if ($("##eftPaymentMethod").is(":checked")) {
					$("##eftContainer").show();
					$("##accountType").val(accountType);
					$("##routingNumber").val(routingNumber);
					$("##accountNumber").val(accountNumber);	
				} else if ($("##checkPaymentMethod").is(":checked")) {
					$("##eftContainer").hide();
					$("##accountType").val("");
					$("##routingNumber").val("");
					$("##accountNumber").val("");
				} else if ($("##dkPaymentMethod").is(":checked")) {
					$("##eftContainer").hide();
					$("##accountType").val("");
					$("##routingNumber").val("");
					$("##accountNumber").val("");
				}
			}
		//-->
		</script>
		<cfform name="scholarBankingForm" id="scholarBankingForm" action="#script_name#" method="post" onsubmit="return validate();">
			<cfinput type="hidden" name="action" value="saveScholar" />
			<cfinput type="hidden" name="Scholarship_ID" value="#GetAuthUser()#" />
			<cfif IsDate(request.scholar.Claim_Date)>
				<cfinput type="hidden" name="view" value="#view#" />
			<cfelse>
				<cfinput type="hidden" name="view" value="editScholarAuthorization" />
			</cfif>
			<div class="row">
				<div class="span12">
					<cfif scholarship.getPBS() eq 0>
						<p>You can have your Cash for College scholarship payment sent to you by one of two methods.</p>
						<ol>
							<li>Electronic Funds Transfer (EFT) deposited directly into a personal checking or savings account</li>
							<li>A check mailed directly to your college or university campus financial aid or scholarship office</li>
						</ol>
						<p>If you have a checking or savings account, EFT is the preferred method.</p>
					<cfelse>
						<p>Your Cash for College scholarship payments will be sent to you by Electronic Funds Transfer (EFT), deposited directly into a personal checking or savings account. This is a great benefit to you, rather than having your scholarship payment sent directly to your campus.</p>
						<p>If opening a personal checking or savings account is absolutely not an option, please select the &quot;I will contact...&quot; option below.</p>
					</cfif>
					
				</div>
			</div>
			<div class="row">
				<div class="span12">
					<div class="text-control clearfix">
						<label class="required">Payment Method</label>
						<label class="radio">
							<cfinput type="radio" id="eftPaymentMethod" name="Payment_Method" value="EFT" checked="#IIf(scholarship.getPayment_Method() eq 'eft', true, false)#" onClick="togglePaymentMethod();"> EFT
						</label>
						<label class="radio">
						<cfinput type="radio" id="checkPaymentMethod" name="Payment_Method" value="Check" checked="#IIf(scholarship.getPayment_Method() eq 'check', true, false)#" onClick="togglePaymentMethod();"> Check
						</label>
						<label class="radio">
						<cfinput type="radio" id="dkPaymentMethod" name="Payment_Method" value="DK" checked="#IIf(scholarship.getPayment_Method() eq 'dk', true, false)#" onClick="togglePaymentMethod();"> I don't know yet. I understand I must return here and choose a payment method to receive my scholarship payment.
						</label>
					</div>
					<div id="eftContainer" style="display: #IIf(scholarship.getPayment_Method() eq 'eft', DE('block'), DE('none'))#">
						<div class="clearfix">
							<label class="required">Account Type</label>
							<cfselect id="accountType" name="Account_Type">
								<option value="">Select...</option>
								<option value="Checking"<cfif scholarship.getAccount_Type() eq "Checking"> selected</cfif>>Checking</option>
								<option value="Savings"<cfif scholarship.getAccount_Type() eq "Savings"> selected</cfif>>Savings</option>
							</cfselect>
						</div>
						<div class="clearfix">
							<label class="required">Bank Routing Number</label>
							<cfinput type="text" id="routingNumber" name="Routing_Number" value="#scholarship.getRouting_Number()#" maxlength="20" style="width: 350px;">
						</div>
						<div class="clearfix">
							<label class="required">Bank Account Number</label>
							<cfinput type="text" id="accountNumber" name="Account_Number" value="#scholarship.getAccount_Number()#" maxlength="20" style="width: 350px;">
						</div>
						<p>Please be careful to provide your correct information.  Incorrect information may delay your scholarship payment.</p>
						<ul> 
							<li><strong>Do not</strong> provide a debit card number</li> 
							<li><strong>Do not</strong> provide a social security number</li>
							<li><strong>Do not</strong> use the numbers in the SAMPLE check below</li>
							<li>If you are using a savings account, look for these numbers on a deposit slip or contact your bank</li>
						</ul>
						<p>Take a look at a sample check with the banking numbers clearly pointed out.</p>
						<p><img src="/applications/scholarships/common/images/dd_check.jpg"></p>
						<p><strong>Bank Routing Number</strong><br />
						The first 9 numbers from the left at the bottom of your check are your Bank Routing Number. This number is always 9 digits. Your Bank Routing Number is NOT a Debit or ATM card number.</p>	
						<p><strong>Checking Account Number</strong><br />
						You can find the Checking Account Number within the line of numbers located at the bottom of one of your checks. It is the second set of numbers, after the Bank Routing Number. Make sure you are using a check and not a deposit slip, since the numbers may not be the same. If you are using a Savings Account Number, you will not find it on your check, but on other banking documents.</p>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="span12">
					<div style="margin-bottom: 20px;">
						<cfif GetUserRoles() eq "scholar">
							<cfinput type="submit" name="saveButton" class="btn btn-primary" value="Save" />
						<cfelse>
							<a href="?view=editScholarAuthorization" class="btn btn-primary">Back</a>
							<button type="submit" name="continueButton" class="btn btn-primary">Continue</button>
						</cfif>
					</div>
				</div>
			</div>
		</cfform>
	<cfelse>
		<div class="row">
			<div class="span12">
				<div class="alert alert-info notFound">Scholarship not found</div>
			</div>
		</div>
	</cfif>
</cfoutput>